﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace TC4T_WinForm
{
    public partial class TCViewer : UserControl
    {
        private TCForm _tcForm;
        public TCViewer()
        {
            InitializeComponent();
        }

        public TCForm Run(string typeName)
        {
            //C1DemoForm d = null;
            Control.ControlCollection items = TcPanel.Controls;
            Type t = Type.GetType(typeName);
            try
            {
                _tcForm = t.Assembly.CreateInstance(t.FullName) as TCForm; ;
                //c1Expander1.HeaderText = title;

                _tcForm.DisplayIn(items);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return _tcForm;
        }

        

        public void Close()
        {
            Control.ControlCollection items = TcPanel.Controls;
            //c1Expander1.HeaderText = "";
            //c1Expander1.ContentText = "";
            TCForm.ClearContainer(items);
        }
    }
}
